import requests

def chat(msg):
    res = requests.get("http://api.qingyunke.com/api.php?key=free&appid=0&msg={}".format(msg)).text
    try:
        res = eval(res)
    except TypeError:
        print("机器人断线了")
        return "机器人断线了"
    finally:
        if res['result'] == 0:
            print(res['content'])
            return res['content']
        else:
            print("好像没收到你发的消息额")
